package javase2.day08.demo01File;

import java.io.File;

/*
File类的判断方法：
1.public boolean exists() 判断路径是否存在        相对路径不好判断，要看当前的working dir
2.public boolean isDirectory() 判断是否以文件夹结尾   互斥
3.public boolean isFile() 判断是否以文件结尾          互斥

 */
public class Demo04 {
    public static void main(String[] args) {
        show1();
        show2();
        show3();
    }

    //1.public boolean exists() 判断路径是否存在
    public static void show1() {
        File f1 = new File("D:\\gitstudydemo\\src\\javase2\\day08\\demo01File");
        System.out.println(f1.exists());//true
    }

    //2.public boolean isDirectory() 判断是否是文件夹
    public static void show2(){
        File f1 = new File("D:\\gitstudydemo\\src\\javase2\\day08\\demo01File");
        boolean d1 = f1.isDirectory();
        System.out.println(d1);//true
    }

    //3.public boolean isFile() 判断是否是文件
    public static void show3(){
        File f1 = new File("D:\\gitstudydemo\\src\\javase2\\day08\\demo01File");
        boolean d1 = f1.isFile();
        System.out.println(d1);//false
    }
}
